package com.lspopi.web.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lspopi.entity.WxRle;
import com.lspopi.service.WxRoleServiceI;


@Controller
@RequestMapping("/wx")
public class WxRoleController {
	private static final Logger logger = LoggerFactory.getLogger(WxRoleController.class);
	@Autowired
	private WxRoleServiceI se;
	
	@RequestMapping({"/index","/"})
	public String index(ModelMap map){
		//获取第1页，3条内容，默认查询总数count
	    PageHelper.startPage(1, 3);
	    Map<String, Object> map2 = new HashMap<String, Object>();
	    map2.put("rule", "music");
		List<WxRle> r = se.selectp(map2);
		logger.info("r is {}" , r);
		//用PageInfo对结果进行包装
		PageInfo<WxRle> page = new PageInfo<WxRle>(r);
		map.put("r", page);
		return "index";
	}
	@RequestMapping({"/gallery","/gallery.html"})
	public String gallery(ModelMap map){
		logger.debug("{}","gallery");
		return "gallery";
	}
}
